/*
 * @Author: your name
 * @Date: 2021-05-17 08:11:38
 * @LastEditTime: 2021-05-17 08:54:27
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \api\lib\pages\apis\gest\gest_home_page.dart
 */
import 'package:flutter/material.dart';

class GestHomePage extends StatefulWidget {
  @override
  _GestHomePageState createState() => _GestHomePageState();
}

class _GestHomePageState extends State<GestHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('手势识别')),
      body: Column(
        children: <Widget>[
          FlatButton(
              child: Text('点击'),
              onPressed: () {
                print("点击啦");
              }),
          // 点击时的顺序 onTapDown-> onTabUp->onPress
          // 长按时的顺序 onTapDown-> onLoingPress -> onLongPressUp
          GestureDetector(
            onTap: () {
              print("ontap");
            },
            onLongPress: () {
              print("onLongPress");
            },
            onTapUp: (de) {
              print("onTapUp");
            },
            onTapDown: (de) {
              print("onTapDown");
            },
            onLongPressUp: () {
              print("onLongPressUp");
            },
            onDoubleTap: () {
              print("双击");
            },
            // 垂直方向上的滑动
            onVerticalDragDown: (de) {
              print('onVerticalDragDown $de');
            },
            onVerticalDragStart: (de) {
              print('onVerticalDragStart $de');
            },
            onVerticalDragCancel: () {
              print('onVerticalDragCancel');
            },
            onVerticalDragEnd: (de) {
              print('onVerticalDragEnd $de');
            },
            onVerticalDragUpdate: (de) {
              print('onVerticalDragUpdate $de');
            },
            // 垂直方向上的滑动

            onHorizontalDragDown: (de) {
              print('onHorizontalDragDown $de');
            },
            onHorizontalDragStart: (de) {
              print('onHorizontalDragStart $de');
            },
            onHorizontalDragCancel: () {
              print('onHorizontalDragCancel');
            },
            onHorizontalDragEnd: (de) {
              print('onHorizontalDragEnd $de');
            },
            onHorizontalDragUpdate: (de) {
              print('onHorizontalDragUpdate $de');
            },
            child: Container(
              child: Text('手势事件'),
              color: Colors.grey,
              margin: EdgeInsets.all(10),
              width: 180,
              height: 180,
            ),
          ),
          // inkwell
          Material(
            color: Colors.grey,
            child: InkWell(
              onTap: () {
                print("点击了inkwell事件");
              },
              child: Container(
                child: Text(
                  '手势事件',
                  style: TextStyle(color: Colors.blue),
                ),
                // alignment: Alignment.center,
                alignment: Alignment(0, 0),
                margin: EdgeInsets.all(10),
                width: 180,
                height: 50,
              ),
            ),
          ),
          SizedBox(height: 10),
          Ink(
            // color 与decoration只能设置一个
            // color: Colors.grey,
            // 用来设置 形状
            decoration: BoxDecoration(
              borderRadius: BorderRadius.all(Radius.circular(25)),
              color: Colors.blue[500],
            ),
            child: InkWell(
              // 设置点击效果的圆角
              borderRadius: BorderRadius.all(Radius.circular(25)),
              // 设置水波纹颜色
              splashColor: Colors.blue[700],
              // 设置按下去的颜色 高亮颜色
              highlightColor: Colors.blue[600],
              // 水波纹的扩散半径
              radius: 100,
              onTap: () {
                print("点击了inkwell事件");
              },
              child: Container(
                child: Text(
                  '手势事件',
                  style: TextStyle(color: Colors.white),
                ),
                // alignment: Alignment.center,
                alignment: Alignment(0, 0),
                margin: EdgeInsets.all(10),
                width: 180,
                height: 30,
              ),
            ),
          )
        ],
      ),
    );
  }
}
